<template>
  <div v-if="msg != null" @click="toHandlingRecords" class="core">
    <!-- 第二块背景图 -->
    <div class="core_icon">
      <img src="../../assets/images/source/source01.png" />
      <span class="core_icon_text" v-text="msg"></span>
    </div>
    <div class="core_bgimg"></div>
  </div>
</template>
<script>
import { queryLastComment } from '@/api/workflow/mf_MyTaskUndo.js'
import { Tp_actionValue } from '@/enumeration/Tp_action.js'
export default {
  props: {
    processinstanceid: {
      type: String,
      require: true,
    },
  },
  data() {
    return {
      msg: null,
    }
  },
  created() {
    this.findLastComment()
  },
  methods: {
    // 点击任务来源跳转的父组件的办理记录
    toHandlingRecords() {
      this.$emit('f_toHandlingRecords')
    },
    findLastComment() {
      queryLastComment(this.processinstanceid).then((res) => {
        console.log('最后一条记录', res)
        if (res.code == 0 && res.data != null) {
          if (res.data.action == Tp_actionValue.APPEND) {
            this.msg = '申请人完成补正'
          } else {
            this.msg = `${res.data.username ? res.data.username : '申请人'}${res.data.type ? res.data.type : '提交申请'}`
          }
        }
      })
    },
  },
}
</script>

<style lang="less" scoped>
.core {
  width: 40%;
  height: 40px;
  // border: 1px solid red;
  position: absolute;
  left: 30%;
  top: 10px;
  background: #fff7ec;
  display: flex;
  justify-content: space-between;
  border-radius: 4px;
  &_icon {
    width: 80%;
    height: 100%;
    // border: 1px solid blue;
    display: flex;
    align-items: center;
    padding-left: 20px;
    &_text {
      padding-left: 20px;
      font-size: 1rem;
      color: #c58120;
    }
  }
  &_bgimg {
    width: 40%;
    background-image: url('../../assets/images/source/source02.png');
  }
}
</style>
